import pygal
from die import Die

results = []
die = Die()
for roll_nums in range(1000):
    result_1 = die.roll()
    result_2 = die.roll()
    results.append(result_1+result_2)
frequencies = []
for value in range(1,13):
    frequency = results.count(value)
    frequencies.append(frequency)

# 绘制直方图
hist = pygal.Bar()
hist.title = "两个骰子同时投掷时的点数和的分布"
hist.x_labels = ['1','2','3','4','5','6','7','8','9','10','11','12']
hist.x_title = "两次点数之和"
hist.y_title = "各种点数出现的频率"
hist.add("D6+d6", frequencies)
hist.render_to_file("dice_visual.svg")
